<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/30
 * Time: 11:31
 */
namespace app\admin\validate;
use think\Validate;

class Member extends Validate
{
    protected $rule = [
        'phone' => ['require','regex' => '/^1[3|4|5|7|8][0-9]\d{4,8}$/i','unique:member',],
        'password' => 'require|length:5,21|regex:/^(?=.*[0-9a-zA-Z]).{6,20}$/',
        'nickname' => 'require'
    ];
    protected $message = [
        'phone.require' => '手机必填',
        'phone.regex' => '手机格式不正确',
        'phone.unique' => '该手机号已被注册',
        'password.require' => '密码必填',
        'password.length' => '密码不能超过5-21位',
        'password.regex' => '密码格式不正确',
        'nickname.require' => '昵称必填',
    ];
    protected $scene = [
        'member_add' => ['phone','password','nickname'],
        'member_edit' => ['phone','nickname'],
    ];
}